<?php
class Sosweb_Util_Validator_ValidateConfirm extends Zend_Validate_Abstract 
{
	protected $_matchedField;
 
	const NOT_CONFIRMED = 'notConfirmed';
 
	protected $_messageTemplates = array(self::NOT_CONFIRMED => 'Podane hasła nie są tożsame.');
 
	public function __construct( Zend_Form_Element $matchedField ) 
	{
		$this->_matchedField = $matchedField;
	}
 
	public function isValid( $value ) 
	{
		if( $this->_matchedField->getValue() == $value ) 
		{
			return true;
		} 
		else 
		{
			$this->_error( self::NOT_CONFIRMED );
			return false;
		}
	} 
}